#ifndef __ALL_H__
#define __ALL_H__

#define ERR_MSG(msg)                           \
    do                                         \
    {                                          \
        fprintf(stderr, "line:%d ", __LINE__); \
        perror(msg);                           \
    } while (0)
 
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/msg.h>
#include <stdbool.h>
#include <pthread.h>
#include <time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <arpa/inet.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/types.h>
#include <sqlite3.h>
#include "msg_queue_peer.h"
#include "pub_define.h"
#include "shmem.h"
#include "struct_JSON.h"
#include "cJSON.h"
#include "modbus-tcp.h"
#include "modbus.h"
#include "MQTTClient.h"

int parse_upjson_to_struct(const char *json_str, struct CJSON *cjson_data);
int parse_downjson_to_struct(const char *json_str, struct msgQueue *queue);
char *serialize_all(const struct STM32 *stm32, const struct Modbus *modbus);
char *serialize_up(struct history_up *his_up);
char *user_up(const int type);
int upjson_to_struct(const char *json_str, struct CJSON *data);

#endif